/**
 * 用户权限管理
 */
import {useLoginStore} from "@/stores/loginStore.js"
import adminData from "@/datas/admin.js"
import userData from "@/datas/user.js"
import {useRouter} from "vue-router"
import mangeRouter from "@/router/dynamicRouter.js";
function handleUserRole()
{
    const loginStore = useLoginStore()
    const roleFromStorage = loginStore.role
    const router = useRouter()

    switch (roleFromStorage) {
        case "admin":
            console.log(adminData.menus)
            // 在这里可以扩展路由形式发送
            router.addRoute('layout',mangeRouter)
            loginStore.permission = adminData.menus
            break;
        case "user":
            console.log(userData.menus)
            // 在这里可以扩展路由形式发送
            loginStore.permission = userData.menus
            break;
        default:
            console.log(adminData.menus)
            // 在这里可以扩展路由形式发送
            loginStore.permission = userData.menus
            break;
    }
}
export {handleUserRole}